<!--
 * @Author: 秦少卫
 * @Date: 2022-09-03 19:16:55
 * @LastEditors: 秦少卫
 * @LastEditTime: 2023-02-26 21:39:45
 * @Description: 删除元素按钮
-->

<template>
  <!-- <Tooltip v-if="mSelectMode" :content="$t('quick.del')">
    <Button @click="del" icon="ios-trash" type="text"></Button>
  </Tooltip> -->
  <div class="tool-item" :data-name="'删除'" @click="del" v-if="mSelectMode">
    <svg t="1683138241136" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
      p-id="35517" width="26" height="26">
      <path
        d="M864 256H736v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32z m-200 0H360v-72h304v72z"
        p-id="35518"></path>
    </svg>
  </div>
</template>

<script>
import select from '../mixins/select';

export default {
  name: 'ToolBar',
  mixins: [select],
  data() {
    return {};
  },
  methods: {
    del() {
      const activeObject = this.canvas.c.getActiveObjects();
      if (activeObject) {
        activeObject.map((item) => this.canvas.c.remove(item));
      }
      this.canvas.c.requestRenderAll();
      this.canvas.c.discardActiveObject();
    },
  },
};
</script>

<style scoped lang="scss">
</style>
